package com.xinxing.learning.crud.batch.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xinxing.learning.crud.batch.entity.User;

import java.sql.SQLException;
import java.util.List;

public interface UserService extends IService<User> {
    /**
     * 批量插入用户
     *
     * @param userList
     */
    int batchInsertUser(List<User> userList);

    /**
     * 多线程批量插入
     * 使用mybatis interceptor 共用一个 connection 方式实现
     * @param userList
     * @throws InterruptedException
     */
    void multipartThreadBatchInsertUser(List<User> userList) throws InterruptedException;

    /**
     * 多线程批量插入
     * 共用一个 SqlSession 方式实现
     * @param userList
     * @throws InterruptedException
     */
    void multipartThreadBatchInsertUserOnSqlSession(List<User> userList) throws SQLException;
}
